﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class BasePanel : MonoBehaviour
{
    //控制淡入淡出的组件 
    private CanvasGroup canvasGroup;
    //淡入淡出速度 
    private float alphaSpeed=10;
    private bool isShow;
    private UnityAction hideAction;
    public virtual void Awake()
    {
        // canvasGroup = GetComponent<CanvasGroup>();
        // if (canvasGroup == null) canvasGroup= this.gameObject.AddComponent<CanvasGroup>();
    }

    public virtual void Show()//虚函数 能够被重写  
    {
    
    }


    public virtual void Hide()
    {
      
    
    }

    private void Update()
    {
        // //淡入
        // if (isShow&&canvasGroup.alpha!=1)
        // {
        //     canvasGroup.alpha += alphaSpeed*Time.deltaTime;
        //     if (canvasGroup.alpha>=1)
        //     {
        //         canvasGroup.alpha = 1;
        //     }
        // }
        // else//淡出
        // {
        //     canvasGroup.alpha -= alphaSpeed*Time.deltaTime;
        //         print(canvasGroup.alpha);
        //     if (canvasGroup.alpha<=0)
        //     {
        //         canvasGroup.alpha = 0;
        //         //删除面板  
        //         hideAction?.Invoke();
        //     }
        // }
    }
}
